home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
asm
/
alib11b.zip
/
CODE1.ZIP
/
DISKINFO
/
DRVINFO.DOC
< prev
next >
Wrap
Text File
|
1994-10-04
|
3KB
|
94 lines
Question:
Is there any way to determine whether a disk drive (either a floppy
disk drive or a hard disk drive) is local or networked?
Response:
Applications can issue MS-DOS INT 21H function 44H, subfunction 9
(IOCTL Is Redirected Block) to determine whether a device is local
(attached to the computer running the program) or remote (redirected
to a network server). See this function's interface description on
Pages 202-203 of the "Microsoft MS-DOS Programmer's Reference" for
version 3.30 for complete details. Please note that currently, any
printed interface description for this function is not entirely
correct with respect to what is returned in the DX register. The
following is the correct information regarding the return value in the
DX register:
DX = device attribute word
bit 15 = 1 device is local
bit 12 = 1 device is remote (per current documentation)
bit 9 = 1 device is shared
Listed below is an Assembler example invoking this function:
.
.
.
mov bl,[drive_no]
mov ax,4409h
int 21h
jc error ; Invalid drive or function
test dx,1000h ; Bit 12 set?
jnz is_remote ; Yes, have remote drive
.
.
.
Another further complication with using this particular function is
the fact that this function does not work correctly in MS-DOS version
4.01. It does not always return the correct values in the DX register.
This function seems to work correctly with Novell Networks, however.
Microsoft has confirmed this to be a problem in MS-DOS version 4.01.
We are researching this problem and will post new information here as
it becomes available.
Please also note that this problem does not occur in MS-DOS version
3.30. Because of this, we have included another example that will also
allow you to determine whether a disk drive is local or remote. This
second method consists of issuing the multiplex interrupt 2FH to see
if the computer has a network redirector installed, and then issuing
INT 21H, function 44H, subfunction 0DH, minor code 60H (IOCTL: Generic
I/O Control for Block Devices: Get Device Parameters) to determine if
error number 5 (access denied) is returned, which would indicate a
network device. For example:
.
.
.
; Establish whether computer has network redirector installed or not
mov ax,1100h ; Redirector code
int 2fh ; Issue multiplex INT
cmp al,0ffh ; 0ffh= redirector installed
jne no_redirector ; No redirector installed
mov [net_redirector],TRUE ; Flag redirector installed
.
.
.
; Get device parameters
mov ax,440dh
mov bl,[drive_no]
mov cx,0860h
mov dx,offset parm_block
int 21h
jnc have_valid_device ; Normal device and not remote
; Error code returned in register AL, use to test for remote device
cmp [net_redirector],FALSE
jz perform_other_err_ck ; No redirector installed
; Network redirector installed
cmp al,5 ; Access denied?
je is_remote ; Yes, have remote drive
; Other errors like: device does not exist, etc.
perform_other_err_ck:
.
.
.